package com.imooc.service;

import com.imooc.domain.Girl;
import com.imooc.repository.GirlRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.transaction.Transactional;

/**
 * Created by Administrator on 2017/7/13.
 */
@Service
public class GirlService {

    @Autowired
    private GirlRepository girlRepository;

    @Transactional  //同时插入多条数据
    public void insertTwo() {
        Girl girla = new Girl();
        girla.setAge(15);
        girla.setCupSize("A");
        Girl girlb = new Girl();
        girlb.setAge(16);
        girlb.setCupSize("B");

        girlRepository.save(girla);
        girlRepository.save(girlb);
    }

}
